package com.thermofisher.dsc.amanda.common.excel.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by wenjie.yang on 4/3/2019.
 */
@Getter
@Setter
@Table(name = "itsc_ar_cache")
public class ITSCARCache  extends BaseRowModel implements Validate{

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @ExcelProperty(index = 3)
  @Column(name = "bt_no")
  private String bill2NO;

  @ExcelProperty(index = 27)
  @Column(name = "bill_date")
  private Date billDate;

  @ExcelProperty(index = 28)
  @Column(name = "expire_date")
  private Date expireDate;

  @ExcelProperty(index = 35)
  @Column(name = "indent_no")
  private String indentNO;

  @ExcelProperty(index = 33)
  @Column(name = "bill_no")
  private String billNO;

  @ExcelProperty(index = 40)
  @Column(name = "overdue_amount")
  private BigDecimal overdueAmount;

  @Override
  public String toString() {
    return "ITSCAR{" +
        "bill2NO='" + bill2NO + '\'' +
        ", billDate=" + billDate +
        ", expireDate=" + expireDate +
        ", indentNO='" + indentNO + '\'' +
        ", billNO='" + billNO + '\'' +
        ", overdueAmount=" + overdueAmount +
        '}';
  }

  @Override
  public boolean validate() {
    if (StringUtils.isBlank(bill2NO)){
      return false;
    }
    return true;
  }
}
